home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 038a / bas_int1.zip / SCROLBOX.BAS < prev    next >
BASIC Source File  |  1991-03-02  |  4KB  |  61 lines

  1. '============================================================================
  2. '   Date : 25-Feb-91
  3. '   From : Larry Stone
  4. 'Subject : Scrolling
  5.                                                                            
  6. 'Below is code that will let you scroll ANY window area; you simply tell
  7. 'the routines top, bottom, left, and right sides of the window and how
  8. 'many lines to scroll and, what color attributes to set in the scrolled
  9. 'area.  Note that BASIC will not be informed of this color and,
  10. 'consequently, when you print to the scrolled area, BASIC will print with
  11. 'the last BASIC color values established.  Also note that unlike BASIC's
  12. 'VIEW PRINT command, you could draw a box and call the ScrollWindowUp or
  13. 'ScrollWindowDown routines to scroll within the box - leaving the box
  14. 'undisturbed.  Final note:  The below routines will not help you once you
  15. 'have shelled to DOS or another program.
  16. '===========================================================================
  17.                                                                              
  18. DECLARE FUNCTION ColorAttr% (Fg%, Bg%)                                       
  19. DECLARE SUB ScrollWindowDown (Trow%, Lcol%, Brow%, Rcol%, HowMany%, Fg%, Bg%)
  20. DECLARE SUB ScrollWindowUp (Trow%, Lcol%, Brow%, Rcol%, HowMany%, Fg%, Bg%)  
  21.                                                                              
  22. ' $INCLUDE: 'qb.bi'
  23.                                                                              
  24. DEFINT A-Z                                                                   
  25.                                                                              
  26.                                                                              
  27. FUNCTION ColorAttr% (Fg%, Bg%) STATIC                                        
  28.                                                                              
  29.   '**** Convert Foreground & Background colors to a screen attribute.        
  30.   BColr% = Bg% * 16                            'Put Back color into range    
  31.   FColr% = Fg%                                 'Set forground color          
  32.   IF FColr% > 15 THEN BColr% = BColr% + 128    'If blink attr, put into Back 
  33.   FColr% = FColr% AND 15                       'Remove blink from Fore       
  34.   ColorAttr% = FColr% + BColr%                 'Create attribute integer     
  35.                                                                              
  36. END FUNCTION                                                                 
  37.                                                                              
  38. SUB ScrollWindowDown (Trow%, Lcol%, Brow%, Rcol%, HowMany%, Fg%, Bg%)        
  39.                                                                              
  40.   DIM reg AS RegType                           'Setup the registers          
  41.   reg.ax = &H700 + HowMany%                    'Scroll down HowMany% lines   
  42.   reg.bx = ColorAttr%(Fg%, Bg%) * 256          'Color attribute of new line
  43.   reg.cx = (Trow% - 1) * 256 + Lcol% - 1       'Upper left corner          
  44.   reg.dx = (Brow% - 1) * 256 + Rcol% - 1       'Lower right corner         
  45.   intNo% = &H10                                'DOS Video BIOS service     
  46.   CALL Interrupt(intNo%, reg, reg)                                         
  47.                                                                            
  48. END SUB                                                                    
  49.                                                                            
  50. SUB ScrollWindowUp (Trow%, Lcol%, Brow%, Rcol%, HowMany%, Fg%, Bg%)        
  51.                                                                            
  52.   DIM reg AS RegType                           'Setup the registers        
  53.   reg.ax = &H600 + HowMany%                    'Scroll up HowMany% lines   
  54.   reg.bx = ColorAttr%(Fg%, Bg%) * 256          'Color attribute of new line
  55.   reg.cx = (Trow% - 1) * 256 + Lcol% - 1       'Upper left corner          
  56.   reg.dx = (Brow% - 1) * 256 + Rcol% - 1       'Lower right corner         
  57.   intNo% = &H10                                'DOS Video BIOS service     
  58.   CALL Interrupt(intNo%, reg, reg)                                         
  59.                                                                            
  60. END SUB                                                                    
  61.